package com.xiaomei.manager.service.impl;



import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaomei.manager.dao.LabelMapper;
import com.xiaomei.manager.model.Label;
import com.xiaomei.manager.service.ILabelService;
import com.xiaomei.manager.web.dto.req.LabelDto;
import com.xiaomei.manager.web.page.Page;

@Service
public class LabelServiceImpl implements ILabelService{
	@Autowired
	private LabelMapper labelMapper;
	@Override
	public List<Label> getByParamMap(Page<Label> page, LabelDto dto) {
		// TODO Auto-generated method stub
		//Map<String,Object> map=new HashMap<String, Object>();
		page.setParamDto(dto);
		return labelMapper.selectByParamMap(page);
	}
	@Override
	public boolean createLabel(Label label) {
		// TODO Auto-generated method stub
		return labelMapper.insertSelective(label) == 1 ? true :false;
	}
	@Override
	public Label findOne(Integer id) {
		// TODO Auto-generated method stub
		return labelMapper.selectByPrimaryKey(id);
	}
	@Override
	public boolean updateLabel(Label label) {
		// TODO Auto-generated method stub
		return labelMapper.updateByPrimaryKeySelective(label) == 1 ? true : false;
	}
	@Override
	public boolean deleteLabel(Integer id) {
		// TODO Auto-generated method stub
		return labelMapper.deleteByPrimaryKey(id)== 1 ? true : false;
	}

}
